﻿CREATE PROCEDURE [dbo].[AddCategory]
	@Model uniqueidentifier,
	@CategoryId uniqueidentifier,
	@Name nvarchar(50),
	@Description nvarchar(max),
    @CreatedBy uniqueidentifier,
    @IsDeleted bit,
	@CreatedOn datetime,
    @LastChanged datetime,
	@LastChangedBy uniqueidentifier,

	@TimeStamp timestamp output

AS

	INSERT INTO Category 

	(Model, CategoryId, Name, [Description], CreatedBy, IsDeleted, CreatedOn, LastChanged, LastChangedBy)

	VALUES 

	(@Model, @CategoryId, @Name, @Description, @CreatedBy, @IsDeleted, @CreatedOn, @LastChanged, @LastChangedBy)

	SELECT @TimeStamp = [TimeStamp]

	FROM Category WHERE CategoryId=@CategoryId

RETURN 0